package com.zzxy.text;

import com.zzxy.entity.User;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;
import java.util.Date;

public class Text1 {
@Test
   public void test1() throws IOException {
       InputStream is = Resources.getResourceAsStream("sqlMapConfig.xml");
s       SqlSessionFactory ssf = new SqlSessionFactoryBuilder().build(is);
       SqlSession session = ssf.openSession();
     /* Object user = session.selectOne("findUserById",10);
      System.out.println(user);*/
    User user =new User();
    user.setUsername("zhangwuji");
    user.setBirthday(new Date());
    user.setSex("1");
    user.setAddress("zz");
  session.insert("insertUser",user);
  session.commit();

   }
}
